Skip to content

add nmk power cut off result#980

Open
ghazwarhili wants to merge 9 commits into
mainfrom
nmk-power-cut-off-result
Open

add nmk power cut off result#980
ghazwarhili wants to merge 9 commits into
mainfrom
nmk-power-cut-off-result

Conversation

@ghazwarhili
Copy link
Copy Markdown
Contributor

PR Summary

add nmk power cut off result

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 21, 2026

Review Change Stack

Warning

Review limit reached

@ghazwarhili, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 56 minutes and 15 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d8995158-0ec6-4eee-81a2-def640636589

📥 Commits

Reviewing files that changed from the base of the PR and between 474fc7c and 5b246d4.

📒 Files selected for processing (1)
  • src/test/java/org/gridsuite/study/server/rootnetworks/SecurityAnalysisTest.java
📝 Walkthrough

Walkthrough

This PR adds NMK_CUT_OFF_POWER to SecurityAnalysisResultType, maps it in SecurityAnalysisService to paged and CSV export endpoints, and extends tests and WireMock helpers to cover the new result type.

Changes

NMK_CUT_OFF_POWER Result Type Support

Layer / File(s) Summary
Enum constant addition
src/main/java/org/gridsuite/study/server/service/securityanalysis/SecurityAnalysisResultType.java
SecurityAnalysisResultType enum is extended with the NMK_CUT_OFF_POWER constant.
Service path routing
src/main/java/org/gridsuite/study/server/service/SecurityAnalysisService.java
getPagedPathFromResultType and getExportPathFromResultType methods are extended with cases that map NMK_CUT_OFF_POWER to its paged and CSV export endpoint paths.
Test coverage and WireMock verification
src/test/java/org/gridsuite/study/server/utils/wiremock/SecurityAnalysisServerStubs.java, src/test/java/org/gridsuite/study/server/rootnetworks/SecurityAnalysisTest.java
Added WireMock verification helper for the nmk-cut-off-power paged endpoint; tests add JSON/CSV fixtures and extend CSV export and paged-result GET tests to exercise resultType=NMK_CUT_OFF_POWER and verify stub interactions.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'add nmk power cut off result' clearly describes the main change—adding support for a new NMK power cut-off result type across service, enum, tests, and stub utilities.
Description check ✅ Passed The description 'add nmk power cut off result' is related to the changeset, repeating the title and matching the primary objective of adding NMK power cut-off result support.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@etiennehomer etiennehomer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a small test in SecurityAnalysisTest

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/test/java/org/gridsuite/study/server/rootnetworks/SecurityAnalysisTest.java (1)

370-392: 💤 Low value

Use a dedicated CSV payload constant for the cut-off-power assertion.

The new stub and assertArrayEquals both reuse SECURITY_ANALYSIS_NMK_CONSTRAINTS_RESULT_CSV_ZIPPED. The routing assertion (distinct URL + verifyPostResultCsv("nmk-cut-off-power-result")) is sound, but reusing the constraints payload means the body assertion can't actually distinguish cut-off-power output from the constraints case. A dedicated constant makes the test self-documenting and catches accidental payload cross-wiring.

♻️ Proposed change
+    private static final byte[] SECURITY_ANALYSIS_NMK_CUT_OFF_POWER_RESULT_CSV_ZIPPED = {0x05, 0x03};
                         .willReturn(aResponse()
                                 .withStatus(200)
                                 .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_OCTET_STREAM_VALUE)
-                                .withBody(SECURITY_ANALYSIS_NMK_CONSTRAINTS_RESULT_CSV_ZIPPED)
+                                .withBody(SECURITY_ANALYSIS_NMK_CUT_OFF_POWER_RESULT_CSV_ZIPPED)
                         )
         );
@@
         byteArrayResult = mvcResult.getResponse().getContentAsByteArray();
-        assertArrayEquals(SECURITY_ANALYSIS_NMK_CONSTRAINTS_RESULT_CSV_ZIPPED, byteArrayResult);
+        assertArrayEquals(SECURITY_ANALYSIS_NMK_CUT_OFF_POWER_RESULT_CSV_ZIPPED, byteArrayResult);
         computationServerStubs.verifyPostResultCsv(SECURITY_ANALYSIS_RESULT_UUID, "nmk-cut-off-power-result");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/test/java/org/gridsuite/study/server/rootnetworks/SecurityAnalysisTest.java`
around lines 370 - 392, Create a dedicated CSV payload constant for the
cut-off-power test instead of reusing
SECURITY_ANALYSIS_NMK_CONSTRAINTS_RESULT_CSV_ZIPPED; define e.g.
SECURITY_ANALYSIS_NMK_CUT_OFF_POWER_RESULT_CSV_ZIPPED and use that new constant
in the WireMock stub (the POST to
"/v1/results/.../nmk-cut-off-power-result/csv") and in the assertion that
compares the response bytes (replace the assertArrayEquals expected value),
leaving the routing verification via
computationServerStubs.verifyPostResultCsv(...) unchanged so the test can
distinguish constraints vs cut-off-power payloads.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@src/test/java/org/gridsuite/study/server/rootnetworks/SecurityAnalysisTest.java`:
- Around line 370-392: Create a dedicated CSV payload constant for the
cut-off-power test instead of reusing
SECURITY_ANALYSIS_NMK_CONSTRAINTS_RESULT_CSV_ZIPPED; define e.g.
SECURITY_ANALYSIS_NMK_CUT_OFF_POWER_RESULT_CSV_ZIPPED and use that new constant
in the WireMock stub (the POST to
"/v1/results/.../nmk-cut-off-power-result/csv") and in the assertion that
compares the response bytes (replace the assertArrayEquals expected value),
leaving the routing verification via
computationServerStubs.verifyPostResultCsv(...) unchanged so the test can
distinguish constraints vs cut-off-power payloads.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 68a82946-fa24-4399-9b97-b0d50bc4bc3b

📥 Commits

Reviewing files that changed from the base of the PR and between 159ad86 and e0e3477.

📒 Files selected for processing (3)
  • src/main/java/org/gridsuite/study/server/service/SecurityAnalysisService.java
  • src/main/java/org/gridsuite/study/server/service/securityanalysis/SecurityAnalysisResultType.java
  • src/test/java/org/gridsuite/study/server/rootnetworks/SecurityAnalysisTest.java

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 2, 2026

@ghazwarhili ghazwarhili requested a review from etiennehomer June 2, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants